package com.woniuxy.oa.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @description:
 * @author: guohao
 * @time: 2019/12/25 17:08
 */
public interface RoleEmpDAO {
    /**
     * 在角色员工中间表增加一条数据
     *
     * @param roleId
     * @param empId
     */
    @Insert("insert into oa_role_emp values(#{roleId},#{empId})")
    public void add(String roleId, String empId);

    /**
     * 通过员工ID删除一条数据
     *
     * @param empId
     */
    @Delete("delete from oa_role_emp re where re.employeeId=#{empId}")
    public void delByEmpId(String empId);

    /**
     * 通过角色ID删除一条数据
     *
     * @param roleId
     */
    @Delete("delete from oa_role_emp re where re.roleId=#{roleId}")
    public void delByRoleId(String roleId);

    /**
     * 通过员工ID查询
     *
     * @param empId
     * @return
     */
    @Select("select * from oa_role_emp re where re.employeeId=#{empId}")
    public List<String> getRoleIdByEmpId(String empId);
}
